home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib16.dsk
/
PERSPECTIVE 3D LISTING #1.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
1KB
|
33 lines
1 REM ************************
2 REM * LISTING#1 *
3 REM * BY RICHARD GOLDSTEIN *
4 REM * COPYRIGHT (C) 1983 *
5 REM * BY MICROSPARC, INC. *
6 REM * LINCOLN, MA. 01773 *
7 REM ************************
10 TEXT : HOME : PRINT "** COPYRIGHT 1983 BY MICROSPARC, INC. **": PRINT : PRINT
20 PRINT "LINE OF SIGHT:": INPUT "XE,YE,ZE=";XE,YE,ZE
30 INPUT "SCALE=";S
40 S1 = XE *XE +YE *YE:S2 = SQR(S1):S3 = SQR(S1 +ZE *ZE):S4 = 1/(S2 *S3)
50 HGR2 : HCOLOR= 3
60 READ N: REM N=NO. OF LINES
70 FOR I = 1 TO N
80 READ X,Y,Z: GOSUB 240
90 U1 = 140 +S *U:V1 = 96 -S *V
100 READ X,Y,Z: GOSUB 240
110 U2 = 140 +S *U:V2 = 96 -S *V
120 HPLOT U1,V1 TO U2,V2
130 NEXT I
140 DATA 15
150 DATA 0,0,0,4,0,0,4,0,0,4,2,0
160 DATA 4,2,0,0,2,0,0,2,0,0,0,0
170 DATA 0,0,0,0,0,2,4,0,0,4,0,2
180 DATA 4,2,0,4,2,2,0,2,0,0,2,2
190 DATA 0,0,2,4,0,2,0,2,2,4,2,2
200 DATA 0,0,2,0,1,3,0,1,3,0,2,2
210 DATA 4,0,2,4,1,3,4,1,3,4,2,2
220 DATA 0,1,3,4,1,3
230 END
240 U = (XE *Y -YE *X)/S2
250 V = (S1 *Z -(X *XE +Y *YE) *ZE) *S4
260 RETURN